export const increaseClick= ()=>{
    return{
        type:'INCREASE'
    }
};

export const decreaseClick= ()=>{
    return{
        type:'DECREASE'
    }
};

export const getListData=(data)=>{
    return{
        type:'GET_DATA',
        data,
    }

}

export const getListDataaa=(data)=>{
    return{
        type:'GET_DATA_PRO',
        data,
    }

}
export const addToCard=(data)=>{
    return{
        type:"ADD_TO_CARD",
        payload:data
    }
}

    export const getdata=(data)=>{
        return dispatch=>{
            return fetch('http://10.31.153.45:3000/news/info/0/3',{
                method: "POST",
                headers: {
                  'Content-Type': 'application/x-www-form-urlencoded'
                }
            })
            .then(res=>{
                return res.json()
            }).then(data=>{
            
               if(data){
                dispatch(getListData(data));     
                
               }              
            })
           
        }
}


export const getProduct=(data)=>{    
    return dispatch=>{
        return fetch('http://10.31.153.45:3000/latiao/list',{
            method: "POST",
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
        .then(res=>{
            return res.json()
        }).then(data=>{
        console.log('prod111',data)
           if(data){
            dispatch(getListDataaa(data));     
            
           }              
        })
       
    }
}


